package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.entity.Employee;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 员工信息
 */
@Mapper
public interface EmployeeMapper {

    /**
     * 根据id查询员工信息
     * @param id
     * @return
     */
    Employee getEmpById(Long id);

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 添加员工
     * @param employee
     */
    @AutoFill(OperationType.INSERT)
    void addEmp(Employee employee);

    /**
     * 分页查询员工列表
     * @param name
     * @return
     */
    Page<Employee> queryPageEmp(String name);

    /**
     * 修改员工状态
     * @param employee
     */
    @AutoFill(OperationType.UPDATE)
    void modifyEmpStatus(Employee employee);

    /**
     * 更新员工信息
     * @param employee
     * @return
     */
    @AutoFill(OperationType.UPDATE)
    void updateEmp(Employee employee);

    /**
     * 修改员工密码
     * @param employee
     */
    @AutoFill(OperationType.UPDATE)
    void modifyPassword(Employee employee);
}
